package chai.ningning.myself;

import java.io.File;

public class Page131 extends Thread{
    //守候线程
    File file = new File("C:");

    @Override
    public void run() {
        while (true){
            long free = file.getFreeSpace();
            System.out.println("C盘剩余空间 ="+free/1024/1024/1024+"G");
            if(free <1024*1024*1024){
                System.err.println("C盘剩余不足1G");
            }
            try {
                sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        Page131 t = new Page131();
        t.setDaemon(true);
        t.start();
    }
}
